//
//  WHAccountInfo.m
//  kxf
//
//  Created by 文 on 2023/5/24.
//

#import "WHAccountInfo.h"
#import "NSDictionary+NSArray+Addition.h"

// 单例宏
#define SYNTHESIZE_SINGLETON_FOR_CLASS(classname) \
\
static classname *shared##classname = nil; \
\
+ (classname *)shared##classname \
{ \
@synchronized(self) \
{ \
if (shared##classname == nil) \
{ \
shared##classname = [[self alloc] init]; \
} \
} \
\
return shared##classname; \
} \
\
+ (id)allocWithZone:(NSZone *)zone \
{ \
@synchronized(self) \
{ \
if (shared##classname == nil) \
{ \
shared##classname = [super allocWithZone:zone]; \
return shared##classname; \
} \
} \
\
return nil; \
} \
\
- (id)copyWithZone:(NSZone *)zone \
{ \
return self; \
}



@implementation WHAccountInfo
SYNTHESIZE_SINGLETON_FOR_CLASS(WHAccountInfo)

- (void)updateAccountMessgage:(NSDictionary *)userCenterDictionary{
    self.expand1 = [userCenterDictionary stringValueForKey:@"expand1"];
    self.expand2 = [userCenterDictionary stringValueForKey:@"expand2"];
    self.expand3 = [userCenterDictionary stringValueForKey:@"expand3"];
    self.expand4 = [userCenterDictionary stringValueForKey:@"expand4"];
    self.expand5 = [userCenterDictionary stringValueForKey:@"expand5"];
    self.expand6 = [userCenterDictionary stringValueForKey:@"expand6"];
    self.expand7 = [userCenterDictionary stringValueForKey:@"expand7"];
    self.expand8 = [userCenterDictionary stringValueForKey:@"expand8"];
    self.appPrivateKey = [userCenterDictionary stringValueForKey:@""];
    self.agentToken = [userCenterDictionary stringValueForKey:@"agentToken"];
    self.startDt = [userCenterDictionary stringValueForKey:@"startDt"];
    self.oemId = [userCenterDictionary stringValueForKey:@"oemId"];
    self.userName = [userCenterDictionary stringValueForKey:@"name"];
    self.referNo = [userCenterDictionary stringValueForKey:@"referNo"];
    self.token = [userCenterDictionary stringValueForKey:@"token"];
    self.phone = [userCenterDictionary stringValueForKey:@"phone"];
    self.identity = [userCenterDictionary stringValueForKey:@"identity"];
    self.endDt = [userCenterDictionary stringValueForKey:@"endDt"];
    self.states = [userCenterDictionary intValueForKey:@""];
    self.uId = [userCenterDictionary intValueForKey:@"id"];
    self.partnerType = [userCenterDictionary intValueForKey:@"partnerType"];
    self.isDelete = [userCenterDictionary intValueForKey:@"isDelete"];
    self.cardStatus = [userCenterDictionary intValueForKey:@"cardStatus"];
    self.avatarUrl = [userCenterDictionary stringValueForKey:@"avatar_url"];
    self.servicePhone = [userCenterDictionary stringValueForKey:@"servicePhone"];
    self.gradeDict = [userCenterDictionary dictionaryValueForKey:@"grade"];
    self.signStatusMerchant = [userCenterDictionary stringValueForKey:@"signStatus"];
    
    self.maxMercNum = [userCenterDictionary stringValueForKey:@"maxMercNum"].intValue;
    self.currentMerc = [userCenterDictionary stringValueForKey:@"mercCode"];
    self.currentMercName = [userCenterDictionary stringValueForKey:@"mercName"];
    
    NSString *phoneStr = [userCenterDictionary stringValueForKey:@"phone"];
    self.phoneStar = [NSString stringWithFormat:@"%@****%@",[phoneStr substringToIndex:3],[phoneStr substringFromIndex:7]];
    
    if (self.userName.length == 2){
        self.userNameStar = [NSString stringWithFormat:@"*%@",[self.userName substringFromIndex:(self.userName.length-1)]];
    }else if (self.userName.length == 3){
        self.userNameStar = [NSString stringWithFormat:@"**%@",[self.userName substringFromIndex:(self.userName.length-1)]];
    }else {
        self.userNameStar = [NSString stringWithFormat:@"***%@",[self.userName substringFromIndex:(self.userName.length-1)]];
    }
}

- (void)clearMsg{
    
}

- (NSString *)expand1{
    return _expand1?_expand1:@"";
}
- (NSString *)expand2{
    return _expand2?_expand2:@"";
}
- (NSString *)expand3{
    return _expand3?_expand3:@"";
}
- (NSString *)expand4{
    return _expand4?_expand4:@"";
}
- (NSString *)expand5{
    return _expand5?_expand5:@"";
}
- (NSString *)expand6{
    return _expand6?_expand6:@"";
}
- (NSString *)expand7{
    return _expand7?_expand7:@"";
}
- (NSString *)expand8{
    return _expand8?_expand8:@"";
}
- (NSString *)appPrivateKey{
    return _appPrivateKey?_appPrivateKey:@"";
}
- (NSString *)agentToken{
    return _agentToken?_agentToken:@"";
}
- (NSString *)startDt{
    return _startDt?_startDt:@"";
}
- (NSString *)oemId{
    return _oemId?_oemId:@"";
}
- (NSString *)userName{
    return _userName?_userName:@"";
}
- (NSString *)referNo{
    return _referNo?_referNo:@"";
}
- (NSString *)token{
    return _token?_token:@"";
}
- (NSString *)phone{
    return _phone?_phone:@"";
}
- (NSString *)phoneStar{
    return _phoneStar?_phoneStar:@"";
}
- (NSString *)identity{
    return _identity?_identity:@"";
}
- (NSString *)endDt{
    return _endDt?_endDt:@"";
}
- (NSString *)avatarUrl{
    return _avatarUrl?_avatarUrl:@"";
}
- (NSDictionary *)gradeDict{
    return _gradeDict?_gradeDict:@{};
}
- (NSDictionary *)accountDict{
    return _accountDict?_accountDict:@{};
}
- (NSString *)faceAuthOrderNo{
    return _faceAuthOrderNo?_faceAuthOrderNo:@"";
}
- (NSString *)agtPhone{
    return _agtPhone?_agtPhone:@"";
}
- (NSString *)servicePhone{
    return _servicePhone?_servicePhone:@"";
}
- (NSString *)signStatusMerchant{
    return _signStatusMerchant?_signStatusMerchant:@"";
}
- (NSString *)currentMerc{
    return _currentMerc?_currentMerc:@"";
    
}
- (NSString *)currentMercName{
    return _currentMercName?_currentMercName:@"";
}
- (NSString *)baobeiMsg{
    return _baobeiMsg?_baobeiMsg:@"";
}
@end
